using ChatBackend.Models;

namespace ChatBackend.Repositories
{
    public interface IChatRoomRepository
    {
        Task<ChatRoom?> GetByIdAsync(int id);
        Task<List<ChatRoom>> GetUserChatRoomsAsync(int userId);
        Task<ChatRoom?> GetDirectChatRoomAsync(int user1Id, int user2Id);
        Task<ChatRoom> CreateAsync(ChatRoom chatRoom);
        Task<ChatRoom> UpdateAsync(ChatRoom chatRoom);
        Task<bool> DeleteAsync(int id);
        Task<bool> ExistsAsync(int id);
        Task<bool> IsUserMemberAsync(int chatRoomId, int userId);
        Task AddUserToChatRoomAsync(int chatRoomId, int userId, UserRole role = UserRole.Member);
        Task RemoveUserFromChatRoomAsync(int chatRoomId, int userId);
        Task<List<User>> GetChatRoomMembersAsync(int chatRoomId);
        Task<UserChatRoom?> GetUserChatRoomAsync(int chatRoomId, int userId);
        Task UpdateLastReadAsync(int chatRoomId, int userId, DateTime lastRead);
    }
}
